package com.wzh.ojbackendjudgeservice.codesandbox.factory;

import com.wzh.ojModel.model.dto.judge.ExecuteCodeRequest;
import com.wzh.ojModel.model.vo.ExecuteCodeResponse;
import com.wzh.ojbackendjudgeservice.codesandbox.CodeSandbox;
import lombok.extern.slf4j.Slf4j;

/**
 * @author wzh
 * 沙箱代理对象，对沙箱进行增强
 */
@Slf4j
public class CodesandboxProxy implements CodeSandbox {

    private final CodeSandbox codeSandbox;

    public CodesandboxProxy(CodeSandbox codeSandbox) {
        this.codeSandbox = codeSandbox;
    }

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        log.info("沙箱代码请求信息"+executeCodeRequest.toString());
        ExecuteCodeResponse executeCodeResponse = codeSandbox.executeCode(executeCodeRequest);
        log.info("沙箱代码响应信息"+executeCodeResponse.toString());
        return executeCodeResponse;
    }
}
